package com.lagou.rpc.consumer;

import com.lagou.rpc.consumer.zookeeper.ZookeeperClient;
import lombok.extern.slf4j.Slf4j;
import org.I0Itec.zkclient.IZkDataListener;
import org.I0Itec.zkclient.ZkClient;
import org.junit.Test;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;

import java.net.InetAddress;
import java.net.UnknownHostException;
import java.time.LocalDateTime;
import java.util.List;

/**
 * Spring Boot启动类
 */
@SpringBootApplication
@EnableScheduling
@Slf4j
public class ClientBootStrap {

    public static void main(String[] args) {
        SpringApplication.run(ClientBootStrap.class, args);
        //1.
        // 1.获取zk连接 （）
        try {
            ZookeeperClient client = new ZookeeperClient();
            client.getConnect();
            // 2.获取/meituan的子节点信息，从中获取服务器信息列表（从美团中获取商家列表）
            client.getServerList();
            // 3.业务进程启动 （对比商家，点餐）
            client.business();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
